-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ddl, variable: add system variable to control Clustered Index feature #17561
Conversation
Codecov Report
@@ Coverage Diff @@
## master #17561 +/- ##
===========================================
Coverage 79.6443% 79.6443%
===========================================
Files 520 520
Lines 140806 140806
===========================================
Hits 112144 112144
Misses 19726 19726
Partials 8936 8936 |
@@ -1112,3 +1112,39 @@ func (s *testSerialSuite) TestInvisibleIndex(c *C) { | |||
tk.MustQuery("select * from t6").Check(testkit.Rows("1 2")) | |||
tk.MustGetErrCode("alter table t6 drop primary key", errno.ErrPKIndexCantBeInvisible) | |||
} | |||
|
|||
func (s *testSerialSuite) TestCreateClusteredIndex(c *C) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some tests for CreateTableLike
ddl/ddl_api.go
Outdated
@@ -1505,7 +1505,14 @@ func buildTableInfoWithStmt(ctx sessionctx.Context, s *ast.CreateTableStmt, dbCh | |||
if err = handleTableOptions(s.Options, tbInfo); err != nil { | |||
return nil, errors.Trace(err) | |||
} | |||
|
|||
if ctx.GetSessionVars().EnableClusteredIndex && !tbInfo.PKIsHandle && !config.GetGlobalConfig().AlterPrimaryKey { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to move to about L1267 if constr.Tp == ast.ConstraintPrimaryKey
and deal with the invisible index checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
/run-unit-test |
What problem does this PR solve?
Support the clustered index feature.
What is changed and how it works?
Add a global variable to control the clustered index feature.
Check List
Tests
Side effects
Release note